<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>封装练习</title>
    <style>
        input{
        width: 100px;
        height: 50px;
        background-color:greenyellow;
        font:700 16px/50px microsoft yahei;
        color:#fff;
    }
        #div1{
            width: 200px;
            height: 200px;
            background-color:lightblue;
            position:absolute;
            left:0;
            top:100px;
        }
    </style>
</head>

<body>
<input type="button" value="向右">
<div id="div1"></div>
<script src="../MyJs.js"></script>
<script>
    var oDiv=document.getElementById("div1");
    var Inp=document.getElementsByTagName("input")[0];
    Inp.onclick=function(){
        oDiv.style.left=parseInt(getStyle(oDiv,"left"))+10+"px";
    }
</script>
</body>
</html>